﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Practices.Unity;
using Microsoft.Win32;

namespace RanbuUI
{
    /// <summary>
    /// Interaction logic for Shell.xaml
    /// </summary>
    public partial class Shell : Window
    {
        [Dependency]
        public MainWindowViewModel ViewModel
        {
            set { this.DataContext = value; }
            get { return this.DataContext as MainWindowViewModel; }
        }

        public Shell()
        {
            InitializeComponent();
            AvalonDock.ThemeFactory.ChangeColors(Colors.Gray);
        }

        private void CanOpen(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }

        private void DoOpen(object sender, ExecutedRoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "BCM files|*.BCM";
            if (dialog.ShowDialog() == true)
            {
                this.ViewModel.OpenBCM(dialog.FileName);
            }
        }
    }
}
